<?php
return [
    // 模块信息
    'module' => [
        'name' => 'meta_table',  // 模块名称
        'title' => '元数据表管理',  // 模块标题
        'table' => 'meta_tables',  // 数据表名
    ],
    
    // 字段定义
    'fields' => [
        'id' => [
            'type' => 'int',
            'length' => 11,
            'comment' => '主键ID',
            'primary' => true,
            'auto_increment' => true,
            'nullable' => false,
            'required' => true,
        ],
        'table_name' => [
            'type' => 'varchar',
            'length' => 64,
            'comment' => '表名',
            'required' => true,
            'rules' => 'required|unique:meta_tables',
            'nullable' => false,
        ],
        'table_comment' => [
            'type' => 'varchar',
            'length' => 255,
            'comment' => '表注释',
            'required' => true,
        ],
        'module_name' => [
            'type' => 'varchar',
            'length' => 64,
            'comment' => '模块名',
            'required' => true,
        ],
        'namespace' => [
            'type' => 'varchar',
            'length' => 255,
            'comment' => '命名空间',
            'required' => true,
        ],
        'fields_config' => [
            'type' => 'json',
            'comment' => '字段配置',
            'required' => true,
            'nullable' => false,
        ],
        'relations_config' => [
            'type' => 'json',
            'comment' => '关联配置',
            'required' => false,
            'nullable' => true,
        ],
        'queries_config' => [
            'type' => 'json',
            'comment' => '查询配置',
            'required' => false,
            'nullable' => true,
        ],
        'options' => [
            'type' => 'json',
            'comment' => '其他选项',
            'required' => false,
            'nullable' => true,
        ],
        'is_generated' => [
            'type' => 'tinyint',
            'length' => 1,
            'comment' => '是否已生成',
            'default' => 0,
            'options' => [
                0 => '未生成',
                1 => '已生成'
            ],
        ],
        'status' => [
            'type' => 'tinyint',
            'length' => 1,
            'comment' => '状态',
            'default' => 1,
            'options' => [
                0 => '禁用',
                1 => '启用'
            ],
        ],
        'created_at' => [
            'type' => 'timestamp',
            'comment' => '创建时间',
            'nullable' => false,
            'default' => 'CURRENT_TIMESTAMP',
            'raw_default' => true
        ],
        'updated_at' => [
            'type' => 'timestamp',
            'comment' => '更新时间',
            'nullable' => false,
            'default' => 'CURRENT_TIMESTAMP',
            'raw_default' => true,
            'extra' => 'ON UPDATE CURRENT_TIMESTAMP'
        ],
    ],
    
    // 查询条件
    'queries' => [
        'table_name' => ['like', '%?%'],
        'module_name' => ['like', '%?%'],
        'status' => ['=', '?'],
        'is_generated' => ['=', '?'],
    ],
]; 